<template>
  <view class="container">
    <view class="device">
      <view class="device_box">
        <view class="device_top">
          <view>设备名称</view>
          <view>维修人</view>
          <view>维修时间</view>
          <view>维修状态</view>
        </view>
        <view v-if="fxyjsbList.length > 0" class="device_bot">
          <view v-for="(item, index) in fxyjsbList" :key="index" class="device_list">
            <view>{{ item.equipmentName  }}</view>
            <view>{{ item.repairPersonName  }}</view>
            <view>{{ item.repairTime  }}</view>
            <view>{{ item.repairStatus == 0 ? '正常' : '异常'  }}</view>
          </view>
        </view>
        <view v-else class="device_bots">
          <view>暂无数据</view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        equipmentId: null,
        fxyjsbList: [],
      }
    },
    onLoad(options) {
      if(options) {
        this.equipmentId = options.equipmentId
      }
      this.getlist()
    },
    methods: {
      getlist() {
        this.$request.getfxyjsbList().then(res => {
          let list = res.rows || []
          list.forEach(v => {
            if(v.equipmentId == this.equipmentId) {
              this.fxyjsbList.push(v)
            }
          })
        })
      },
    },
  }
</script>

<style lang="scss" scoped>
  .device {
    .device_box {

      .device_top {
        display: flex;
        align-items: center;
        padding: 20rpx 0;

        view {
          flex: 1;
          text-align: center;
          font-size: 30rpx;
          line-height: 30rpx;
        }
      }

      .device_bot {
        border-top: 1px solid #e9e7e7;

        .device_list {
          display: flex;
          align-items: center;
          padding: 20rpx 0;
          border-bottom: 1px solid #e9e7e7;

          view {
            flex: 1;
            text-align: center;
            font-size: 28rpx;
            line-height: 28rpx;
          }
        }
      }

      .device_bots {
        view {
          width: 100%;
          text-align: center;
          padding-top: 50rpx;
          font-size: 30rpx;
        }
      }
    }
  }
</style>
